// 路由工厂函数
function routeFactory(type, options) {
  const commonMeta = { 
    layout: 'Default',
    middleware: []
  }
  
  switch(type) {
    case 'public':
      return {
        path: options.path,
        component: () => import(`@/views/${options.component}`),
        meta: { ...commonMeta, requiresAuth: false }
      }
    case 'private':
      return {
        path: options.path,
        component: () => import(`@/views/${options.component}`),
        meta: { ...commonMeta, requiresAuth: true }
      }
    case 'admin':
      return {
        path: options.path,
        component: () => import(`@/views/${options.component}`),
        meta: { ...commonMeta, requiresAuth: true, requiresAdmin: true }
      }
    default:
      throw new Error('Unknown route type')
  }
} 

// 使用工厂函数创建路由
const routes = [
  routeFactory('public', { path: '/', component: 'Home' }),
  routeFactory('private', { path: '/profile', component: 'Profile' }),
  routeFactory('admin', { path: '/dashboard', component: 'Dashboard' })
]